/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.insurance.service;

import me.zhengjie.modules.insurance.domain.InsuredUser;
import me.zhengjie.modules.insurance.pojo.MatchingSiteRequest;
import me.zhengjie.modules.insurance.service.dto.InsuredUserDto;
import me.zhengjie.modules.insurance.service.dto.InsuredUserQueryCriteria;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
* @website https://el-admin.vip
* @description 服务接口
* @author HeHui
* @date 2021-12-26
**/
public interface InsuredUserService {

    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(InsuredUserQueryCriteria criteria, Pageable pageable);

    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<InsuredUserDto>
    */
    List<InsuredUserDto> queryAll(InsuredUserQueryCriteria criteria);

    /**
     * 根据ID查询
     * @param id ID
     * @return InsuredUserDto
     */
    InsuredUserDto findById(Long id);

    /**
    * 创建
    * @param resources /
    * @return InsuredUserDto
    */
    InsuredUserDto create(InsuredUser resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(InsuredUser resources);

    /**
    * 多选删除
     * @param ids /
     * @param currentUserId
     */
    void deleteAll(Long[] ids, Long currentUserId);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<InsuredUserDto> all, HttpServletResponse response) throws IOException;


    /**
     * 存在生效中的保单
     *
     * @param userIdCard 用户id卡
     * @param notId      忽略的ID
     * @return boolean
     */
    boolean existsEffectPolicy(String userIdCard, Long notId);

    /**
     * 批量减员导出
     *
     * @param ids           id
     * @param currentUserId 当前用户id
     */
    void batchOut(List<Long> ids, long currentUserId);

    /**
     * 上传
     *
     * @param file          文件
     * @param currentUserId 当前用户id
     */
    void upload(MultipartFile file, long currentUserId) throws IOException;

    /**
     * 匹配所属公司
     *
     * @param request 请求
     * @return {@link Long}
     */
    Long matchingCompany(MatchingSiteRequest request);

    /**
     * 匹配
     *
     * @param request 请求
     * @return {@link InsuredUserDto}
     */
    InsuredUserDto matching(MatchingSiteRequest request);


}